package com.le.tester.javaThink.fifth.chapter12_Collections;

import com.le.tester.javaThink.fourth.typeinfo.pets.Cat;
import com.le.tester.javaThink.fourth.typeinfo.pets.Dog;
import com.le.tester.javaThink.fourth.typeinfo.pets.Hamster;
import com.le.tester.javaThink.fourth.typeinfo.pets.Pet;

import java.util.HashMap;
import java.util.Map;

/**
 * createTime：2021/8/30 16:08
 * description：PetMap
 */
public class PetMap {
    public static void main(String[] args) {
        Map<String, Pet> petMap = new HashMap<>();

        petMap.put("My Cat", new Cat("Molly"));
        petMap.put("My Dog", new Dog("Ginger"));
        petMap.put("My Hamster", new Hamster("Bosco"));
        System.out.println(petMap);

        Pet dog = petMap.get("My Dog");
        System.out.println(dog);
        System.out.println(petMap.containsKey("My Dog"));
        System.out.println(petMap.containsValue(dog));
    }
}
